home *** CD-ROM | disk | FTP | other *** search
- unit Restruc1;
- {
- *********************************************************
- * *
- * demo for use of def files with local tables *
- * *
- * (c) 1996-97 Reinhard Kalinke *
- * *
- *********************************************************
- }
-
- {NOTE: You are not allowed to give this or a similar application
- away as a whole, that is including any method to write def files!}
-
- {NOTE: When compiling the samples or a project of your own using
- BDEDoRxS methods with Delphi 1 tests seem to indicate that you
- better increase stack size to 24 or even 32k.}
-
- interface
-
- uses
- WinTypes, WinProcs, Messages, SysUtils, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, FileCtrl, DB, Px7Table, IniFiles, ExtCtrls,
- {$IFDEF WIN32}
- ComCtrls,
- {$ELSE}
- Gauges,{}
- {$ENDIF}
- DBIProcs, DBITypes, DBIErrs, DBTables;
-
- type
- TMainForm = class(TForm)
- GroupBox1: TGroupBox;
- AliasCB: TComboBox;
- GroupBox2: TGroupBox;
- DriveBox1: TDriveComboBox;
- DirBox1: TDirectoryListBox;
- GroupBox3: TGroupBox;
- GroupBox4: TGroupBox;
- FileBox1: TFileListBox;
- TblCreateCB: TCheckBox;
- IndexCB: TCheckBox;
- AllBtn: TButton;
- NoneBtn: TButton;
- DoItBtn: TButton;
- CloseBtn: TButton;
- RestTbl: TPx7Table;
- RestDB: TDatabase;
- DeleteCB: TCheckBox;
- ValcheckCB: TCheckBox;
- RefIntCB: TCheckBox;
- OpRG: TRadioGroup;
- Panel1: TPanel;
- Panel2: TPanel;
- IdxCB: TCheckBox;
- Edit1: TEdit;
- Label1: TLabel;
- FieldIDCB: TCheckBox;
- procedure FormShow(Sender: TObject);
- procedure AliasCBChange(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure DoItBtnClick(Sender: TObject);
- procedure AllBtnClick(Sender: TObject);
- procedure CloseBtnClick(Sender: TObject);
- procedure OpRGClick(Sender: TObject);
- procedure FileBox1Change(Sender: TObject);
- procedure Label1Click(Sender: TObject);
- procedure ValcheckCBClick(Sender: TObject);
- procedure IdxCBClick(Sender: TObject);
- private
- { Private-Deklarationen }
- FCalced: boolean;
- FBDEVersion: string;
- FDeleteVals: boolean;
- FPreventSizing: boolean;
- {$IFDEF WIN32}
- ProgressBar1: TProgressBar;
- {$ELSE}
- ProgressBar1: TGauge;
- {$ENDIF}
- {not currently needed by this project as it's window
- style is bsSingle. included for use with other styles}
- procedure WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo);
- message WM_GETMINMAXINFO;
- procedure WMNCHitTest(var Msg: TWMNCHitTest);
- message WM_NCHitTest;
- procedure WMInitMenuPopup(var Msg: TWMInitMenuPopup);
- message WM_INITMENUPOPUP;
- public
- { Public-Deklarationen }
- end;
-
- var
- MainForm: TMainForm;
-
- implementation
-
- {$R *.DFM}
-
- uses BDEDoRxS;
-
- procedure AssignDBDir(ADataBase: TDataBase; const AFileName: TFileName);
- begin
- with ADataBase do
- if (Params.Count = 0)
- or (Params[0] <> 'PATH='+AFileName) then
- begin
- if Connected then Connected := False;
- DriverName := 'STANDARD'; {clears any alias as well}
- Params.Clear;
- Params.Add('PATH='+AFileName);
- Open;
- end;
- end;
-
- {'Wrappers' you might want to paste into your apps/restructors.
- For an example on how to use them check form method DoItBtnClick}
-
- procedure SetProgress({$IFDEF WIN32}AProgressBar: TProgressBar;
- {$ELSE}AProgressBar: TGauge;{$ENDIF}
- const Count: integer; Reset: boolean);
- begin
- if Reset then
- begin
- {$IFDEF WIN32}
- AProgressBar.Position := 0;
- AProgressBar.Max := Count;
- {$ELSE}
- AProgressBar.Progress := 0;
- AProgressBar.MaxValue := Count; {}
- {$ENDIF}
- end
- else
- {$IFDEF WIN32}
- AProgressBar.Position := Count;
- {$ELSE}
- AProgressBar.Progress := Count; {}
- {$ENDIF}
- end;
-
- {writes table defs for a list of tables}
- procedure DoWriteTableDefsToFile(AFileList: TStrings;
- ATable: TTable;
- const AVersion: string;
- DoUseFieldIDs: boolean;
- {$IFDEF WIN32}
- AProgressBar: TProgressBar;
- {$ELSE}
- AProgressBar: TGauge;{}
- {$ENDIF}
- AStatusPanel: TPanel);
- var i,iProg: integer;
- DBFile, DefFile: TFileName;
- begin
- Screen.Cursor := crHourGlass;
- try
- iProg := 0;
- SetProgress(AProgressBar,AFileList.Count,True);
- for i:=0 to pred(AFileList.Count) do
- begin
- DBFile := AFileList.Strings[i];
- DefFile := ChangeFileExt(DBFile,'.dbi');
- with TIniFile.Create(DefFile) do
- try
- ATable.TableName := ExtractFileName(DBFile);
- ATable.Open;
- AStatusPanel.Caption := 'creating table def: '
- +DefFile;
- AStatusPanel.Update;
- BDESaveTableDefsToFile(ATable, DefFile);
- if (AVersion > '') then
- WriteString('Table','Version',AVersion);
- if DoUseFieldIDs then
- WriteString('Table','FieldCompare','ByFieldID')
- else
- WriteString('Table','FieldCompare','ByFieldName');
- finally
- Free;
- ATable.Close;
- end;
- inc(iProg);
- SetProgress(AProgressBar,iProg,False);
- end;
- AStatusPanel.Caption := 'Done!';
- AStatusPanel.Update;
- finally
- Screen.Cursor := crDefault;
- end;
- end;
-
- {writes index defs only for a list of tables}
- procedure DoWriteIndexDefsToFile(AFileList: TStrings;
- ATable: TTable;
- const AVersion: string;
- {$IFDEF WIN32}
- AProgressBar: TProgressBar;
- {$ELSE}
- AProgressBar: TGauge;
- {$ENDIF}
- AStatusPanel: TPanel);
- var i,iProg: integer;
- DBFile, DefFile: TFileName;
- begin
- Screen.Cursor := crHourGlass;
- try
- iProg := 0;
- SetProgress(AProgressBar,AFileList.Count,True);
- for i:=0 to pred(AFileList.Count) do
- begin
- DBFile := AFileList.Strings[i];
- DefFile := ChangeFileExt(DBFile,'.dbx');
- with TIniFile.Create(DefFile) do
- try
- ATable.TableName := ExtractFileName(DBFile);
- ATable.Open;
- AStatusPanel.Caption := 'creating index def: '
- +DefFile;
- AStatusPanel.Update;
- BDESaveIndexDefsToFile(ATable, DefFile);
- if (AVersion > '') then
- WriteString('Table','Version',AVersion);
- finally
- Free;
- ATable.Close;
- end;
- inc(iProg);
- SetProgress(AProgressBar,iProg,False);
- end;
- AStatusPanel.Caption := 'Done!';
- AStatusPanel.Update;
- finally
- Screen.Cursor := crDefault;
- end;
- end;
-
- {processes table defs with thw whole range of current
- options (indices, RI, Val)}
- procedure DoRestructureFromFile(AFileList: TStrings;
- ADataBase: TDataBase;
- ATable: TTable;
- {$IFDEF WIN32}
- AProgressBar: TProgressBar;
- {$ELSE}
- AProgressBar: TGauge;
- {$ENDIF}
- AStatusPanel: TPanel;
- const DoCreateTables,
- DoCreateIndices,
- DoCreateRefInt,
- DoCreateValchecks,
- DoDeleteDefs: boolean);
- var i,j,iProg,iPass,iPasses: integer;
- DefFile, DBFile: TFileName;
- DoIndex: boolean;
- ActionStr: string;
- ExcValue: DBIResult;
- begin
- Screen.Cursor := crHourGlass;
- try
- DoIndex := DoCreateIndices;
- if (DoCreateRefInt or DoCreateValchecks) then
- iPasses := 2 else iPasses := 1;
- SetProgress(AProgressBar,AFileList.Count*(1+ord(DoIndex)),True);
- for iPass:=1 to iPasses do
- begin
- iProg := 0;
- SetProgress(AProgressBar,iProg,False);
- if (iPass = 1) then
- ActionStr := 'processing: '
- else
- ActionStr := 'creating RI and/or ValChecks: ';
- for i:=0 to pred(AFileList.Count) do
- begin
- DefFile := AFileList.Strings[i];
- with TIniFile.Create(DefFile) do
- try
- ATable.TableName := ReadString('Table','Name','');
- AStatusPanel.Caption := ActionStr+ATable.TableName;
- AStatusPanel.Update;
- if (iPass = 2) then
- begin
- ATable.Open;
- {'Bugfix' BDE4.0:}
- if MainForm.FDeleteVals then
- BDEDropValFile(ATable);
- if DoCreateRefInt then
- {dropping existing RI is included
- with below function}
- BDEAddRIFromFile(ATable, DefFile);
- inc(iProg);
- SetProgress(AProgressBar,iProg,False);
- if DoCreateValchecks then
- {dropping existing val is included
- with below function}
- BDEAddValchecksFromFile(ATable, DefFile); {}
- inc(iProg);
- SetProgress(AProgressBar,iProg,False);
- Continue;
- end
- else
- try
- ATable.Open;
- BDERestructTableFromFile(ATable, DefFile);
- inc(iProg);
- SetProgress(AProgressBar,iProg,False);
- except
- on E:EDBEngineError do
- begin
- DoIndex := DoCreateIndices and DoCreateTables;
- {if table does not exist:}
- for j:=0 to pred(E.ErrorCount) do
- begin
- if DoCreateTables
- and (E.Errors[j].ErrorCode = DBIERR_NOSUCHTABLE) then
- begin
- BDECreateTableFromFile(ADataBase, DefFile);
- inc(iProg);
- SetProgress(AProgressBar,iProg,False);
- ATable.Open;
- DBISaveChanges(ATable.Handle);
- Break;
- end
- else raise;
- end;
- end;
- else raise;
- end;
- if DoIndex then
- {dropping existing indices is included
- with below function}
- BDEAddIndicesFromFile(ATable, DefFile);
- inc(iProg);
- SetProgress(AProgressBar,iProg,False);
- finally
- Free;
- ATable.Close;
- end;
- end;
- end;
- AStatusPanel.Caption := 'Done!';
- AStatusPanel.Update;
- finally
- Screen.Cursor := crDefault;
- end;
- if DoDeleteDefs then
- begin
- for i:=0 to pred(AFileList.Count) do
- SysUtils.DeleteFile(AFileList.Strings[i]);
- end;
- end;
-
- {processes table defs for field restructure and indices only
- (no RI or Val processing)}
- procedure DoSimpleRestructureFromFile(AFileList: TStringList;
- ADataBase: TDataBase;
- ATable: TTable;
- {$IFDEF WIN32}
- AProgressBar: TProgressBar;
- {$ELSE}
- AProgressBar: TGauge;
- {$ENDIF}
- AStatusPanel: TPanel;
- const DoCreateTables,
- DoCreateIndices,
- DoDeleteDefs: boolean);
- var i,j,iProg: integer;
- DefFile, DBFile: TFileName;
- DoIndex: boolean;
- ExcValue: DBIResult;
- begin
- Screen.Cursor := crHourGlass;
- try
- DoIndex := DoCreateIndices;
- iProg := 0;
- SetProgress(AProgressBar,AFileList.Count*(1+ord(DoIndex)),True);
- for i:=0 to pred(AFileList.Count) do
- begin
- DefFile := AFileList.Strings[i];
- with TIniFile.Create(DefFile) do
- try
- ATable.TableName := ReadString('Table','Name','');
- AStatusPanel.Caption := 'processing: '+ATable.TableName;
- AStatusPanel.Update;
- try
- ATable.Open;
- BDERestructTableFromFile(ATable, DefFile);
- inc(iProg);
- SetProgress(AProgressBar,iProg,False);
- except
- on E:EDBEngineError do
- begin
- DoIndex := DoCreateIndices and DoCreateTables;
- {if table does not exist:}
- for j:=0 to pred(E.ErrorCount) do
- begin
- if DoCreateTables
- and (E.Errors[j].ErrorCode = DBIERR_NOSUCHTABLE) then
- begin
- BDECreateTableFromFile(ADataBase, DefFile);
- inc(iProg);
- SetProgress(AProgressBar,iProg,False);
- ATable.Open;
- DBISaveChanges(ATable.Handle);
- Break;
- end
- else raise;
- end;
- end;
- else raise;
- end;
- if DoIndex then
- BDEAddIndicesFromFile(ATable, DefFile);
- inc(iProg);
- SetProgress(AProgressBar,iProg,False);
- finally
- Free;
- ATable.Close;
- end;
- end;
- AStatusPanel.Caption := 'Done!';
- AStatusPanel.Update;
- finally
- Screen.Cursor := crDefault;
- end;
- if DoDeleteDefs then
- begin
- for i:=0 to pred(AFileList.Count) do
- SysUtils.DeleteFile(AFileList.Strings[i]);
- end;
- end;
-
- {processes defs for indices only}
- procedure DoProcessIndicesFromFile(AFileList: TStringList;
- ATable: TTable;
- {$IFDEF WIN32}
- AProgressBar: TProgressBar;
- {$ELSE}
- AProgressBar: TGauge;
- {$ENDIF}
- AStatusPanel: TPanel;
- const DoDeleteDefs: boolean);
- var i,iProg,iPass,iPasses: integer;
- DefFile, DBFile: TFileName;
- Res: integer;
- FileRec: TSearchRec;
- begin
- Screen.Cursor := crHourGlass;
- try
- iProg := 0;
- SetProgress(AProgressBar,AFileList.Count,True);
- for i:=0 to pred(AFileList.Count) do
- begin
- DefFile := AFileList.Strings[i];
- with TIniFile.Create(DefFile) do
- try
- ATable.TableName := ReadString('Table','Name','');
- AStatusPanel.Caption := 'creating indices: '+ATable.TableName;
- AStatusPanel.Update;
- ATable.Open;
- {dropping indices is included with below function}
- BDEAddIndicesFromFile(ATable, DefFile);
- inc(iProg);
- SetProgress(AProgressBar,iProg,False);
- finally
- Free;
- ATable.Close;
- end;
- end;
- AStatusPanel.Caption := 'Done!';
- AStatusPanel.Update;
- finally
- Screen.Cursor := crDefault;
- end;
- if DoDeleteDefs then
- begin
- for i:=0 to pred(AFileList.Count) do
- SysUtils.DeleteFile(AFileList.Strings[i]);
- end;
- end;
-
- {processes index defs for a list of files in case of
- index errors ('Index out of date')}
- procedure DoRecoverIndicesFromFile(AFileList: TStringList;
- ADB: TDataBase;
- ATable: TTable;
- {$IFDEF WIN32}
- AProgressBar: TProgressBar;
- {$ELSE}
- AProgressBar: TGauge;
- {$ENDIF}
- AStatusPanel: TPanel;
- const DoDeleteDefs: boolean);
- var i,iProg,iPass,iPasses: integer;
- DefFile, DBFile: TFileName;
- Res: integer;
- FileRec: TSearchRec;
- begin
- Screen.Cursor := crHourGlass;
- try
- iProg := 0;
- SetProgress(AProgressBar,AFileList.Count,True);
- for i:=0 to pred(AFileList.Count) do
- begin
- DefFile := AFileList.Strings[i];
- with TIniFile.Create(DefFile) do
- try
- ATable.TableName := ReadString('Table','Name','');
- AStatusPanel.Caption := 'recovering indices: '+ATable.TableName;
- AStatusPanel.Update;
- BDERecoverIndicesFromFile(ADB, ATable.TableName, DefFile);
- inc(iProg);
- SetProgress(AProgressBar,iProg,False);
- finally
- Free;
- end;
- end;
- AStatusPanel.Caption := 'Done!';
- AStatusPanel.Update;
- finally
- Screen.Cursor := crDefault;
- end;
- if DoDeleteDefs then
- begin
- for i:=0 to pred(AFileList.Count) do
- SysUtils.DeleteFile(AFileList.Strings[i]);
- end;
- end;
- {end of 'wrapper' section}
-
- procedure TMainForm.DoItBtnClick(Sender: TObject);
- var AFileList: TStringList;
- i: integer;
- begin
- if (AliasCB.Text <> 'use Directories') then
- begin
- RestDB.Close;
- RestDB.Params.Clear;
- RestDB.AliasName := AliasCB.Text;
- RestDB.Open;
- end
- else
- AssignDBDir(RestDB,DirBox1.Directory);
- AFileList := TStringList.Create;
- try
- for i:=0 to pred(FileBox1.Items.Count) do
- if FileBox1.Selected[i] then
- AFileList.Add(DirBox1.Directory+'\'+FileBox1.Items[i]);
- if (Sender = DoItBtn) then
- begin
- if (OpRG.ItemIndex = 0) then
- begin
- if IdxCB.Checked then
- DoWriteIndexDefsToFile(AFileList,RestTbl,Edit1.Text,
- ProgressBar1,Panel1)
- else
- DoWriteTableDefsToFile(AFileList,RestTbl,Edit1.Text,
- FieldIDCB.Checked,ProgressBar1,Panel1);
- end
- else
- begin
- if IdxCB.Checked then
- DoRecoverIndicesFromFile(AFileList,RestDB,RestTbl,
- ProgressBar1,Panel1,
- DeleteCB.Checked)
- else
- DoRestructureFromFile(AFileList,RestDB,RestTbl,ProgressBar1,Panel1,
- TblCreateCB.Checked,IndexCB.Checked,
- RefIntCB.Checked,ValcheckCB.Checked,
- DeleteCB.Checked); {}
- {DoSimpleRestructureFromFile(AFileList,RestDB,RestTbl,ProgressBar1,Panel1,
- TblCreateCB.Checked,IndexCB.Checked,
- DeleteCB.Checked); {}
- end;
- end;
- finally
- AFileList.Free;
- end;
- end;
-
- procedure TMainForm.FormShow(Sender: TObject);
- begin
- if not FCalced then
- begin
- CalcControlSize(self);
- {$IFDEF WIN32}
- FBDEVersion := BDEGetIdapi32Version;
- {$ELSE}
- FBDEVersion := BDEGetIdapi16Version;
- {$ENDIF}
- FCalced := True;
- FPreventSizing := True;
- end;
- end;
-
- procedure TMainForm.AliasCBChange(Sender: TObject);
- begin
- if (AliasCB.Text <> 'use Directories') then
- DirBox1.Directory := BDEGetDBPath(AliasCB.Text);
- DirBox1.Enabled := (AliasCB.Text = 'use Directories');
- DriveBox1.Enabled := (AliasCB.Text = 'use Directories');
- end;
-
- procedure TMainForm.FormCreate(Sender: TObject);
- var Handle: THandle;
- ExeName: array[0..240] of char;
- begin
- StrPCopy(ExeName,Application.ExeName);
- Handle := GetModuleHandle(ExeName);
- {$IFDEF WIN32}
- ProgressBar1 := TProgressBar.Create(self);
- {$ELSE}
- ProgressBar1 := TGauge.Create(self); {}
- {$ENDIF}
- with ProgressBar1 do
- begin
- Parent := Panel2;
- Align := alClient;
- Visible := True;
- end;{}
- Session.GetAliasNames(AliasCB.Items);
- AliasCB.Items.Insert(0,'use Directories');
- AliasCB.ItemIndex := 0;
- OpRGClick(self);
- end;
-
- procedure TMainForm.AllBtnClick(Sender: TObject);
- var i: integer;
- begin
- with FileBox1 do
- begin
- Items.BeginUpdate;
- for i := pred(Items.Count) downto 0 do
- Selected[i] := (Sender = AllBtn);
- Items.EndUpdate;
- end;
- FileBox1Change(Sender);
- end;
-
- procedure TMainForm.CloseBtnClick(Sender: TObject);
- begin
- Application.Terminate;
- end;
-
- procedure TMainForm.OpRGClick(Sender: TObject);
- var i: integer;
- begin
- for i:=0 to pred(ComponentCount) do
- if (Components[i] is TCheckBox)
- and (Components[i].Tag < 2) then
- TCheckBox(Components[i]).Enabled := (OpRG.ItemIndex = 1)
- xor (Components[i].Tag = 1);
- FileBox1.Items.BeginUpdate;
- if (OpRG.ItemIndex = 0) then
- begin
- FileBox1.Mask := '*.db;*.dbf';
- GroupBox4.Caption := ' Tables ';
- end
- else
- begin
- if IdxCB.Checked then
- FileBox1.Mask := '*.dbx'
- else
- FileBox1.Mask := '*.dbi';
- GroupBox4.Caption := ' Def-files ';
- end;
- FileBox1.Items.EndUpdate;
- Edit1.Enabled := (OpRG.ItemIndex = 0);
- Label1.Enabled := (OpRG.ItemIndex = 0);
- FileBox1.Update;
- {$IFDEF WIN32}
- ProgressBar1.Position := 0;
- {$ELSE}
- ProgressBar1.Progress := 0;{}
- {$ENDIF}
- Panel1.Caption := ' Idle...';
- end;
-
- procedure TMainForm.FileBox1Change(Sender: TObject);
- begin
- DoItBtn.Enabled := (FileBox1.SelCount > 0);
- end;
-
- procedure TMainForm.Label1Click(Sender: TObject);
- begin
- TblCreateCB.Checked := not TblCreateCB.Checked;
- end;
-
- procedure TMainForm.IdxCBClick(Sender: TObject);
- begin
- IndexCB.Enabled := (not IdxCB.Checked) and (OpRG.ItemIndex = 1);
- RefIntCB.Enabled := (not IdxCB.Checked) and (OpRG.ItemIndex = 1);
- ValcheckCB.Enabled := (not IdxCB.Checked) and (OpRG.ItemIndex = 1);
- TblCreateCB.Enabled := (not IdxCB.Checked) and (OpRG.ItemIndex = 1);
- FieldIDCB.Enabled := (not IdxCB.Checked) and (OpRG.ItemIndex = 0);
- if (OpRG.ItemIndex = 0) then Exit;
- if IdxCB.Checked then
- FileBox1.Mask := '*.dbx'
- else
- FileBox1.Mask := '*.dbi';
- FileBox1.Update;
- {$IFDEF WIN32}
- ProgressBar1.Position := 0;
- {$ELSE}
- ProgressBar1.Progress := 0; {}
- {$ENDIF}
- Panel1.Caption := ' Idle...';
- end;
-
- procedure TMainForm.ValcheckCBClick(Sender: TObject);
- begin
- if ValcheckCB.Checked and (FBDEVersion = '4.00') then
- case MessageDlg('You are using version '+FBDEVersion+' of BDE.'+#13#10
- +'Due to a serious bug in this version there is no way'+#13#10
- +'valcheck deletes correctly'+#13#10
- +#13#10
- +'Possible remedies:'+#13#10
- +#13#10
- +'Choose "Yes" to delete all *.VAL files before (re-)creation.'+#13#10
- +'Note that this will also delete all RI checks for the tables'+#13#10
- +'Don''t forget to recreate them as well.'+#13#10
- +#13#10
- +'Choose "No" for an internal error handling that will not'+#13#10
- +'delete the checks but only "null" them.',
- mtConfirmation,mbYesNoCancel,0) of
- mrYes: FDeleteVals := True;
- mrNo: FDeleteVals := False;
- mrCancel: ValcheckCB.Checked := False;
- end;
- end;
-
- procedure TMainForm.WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo);
- begin
- inherited;
- if FPreventSizing then
- with (self), Msg.MinMaxInfo^ do
- begin
- ptMinTrackSize.x:= Width;
- ptMaxTrackSize.x:= Width;
- ptMinTrackSize.y:= Height;
- ptMaxTrackSize.y:= Height;
- end;
- end;
-
- procedure TMainForm.WMInitMenuPopup(var Msg: TWMInitMenuPopup);
- begin
- inherited;
- if FPreventSizing and Msg.SystemMenu then
- begin
- EnableMenuItem(Msg.MenuPopup, SC_SIZE, MF_BYCOMMAND or MF_GRAYED);
- EnableMenuItem(Msg.MenuPopup, SC_MAXIMIZE, MF_BYCOMMAND or MF_GRAYED);
- end;
- end;
-
- procedure TMainForm.WMNCHitTest(var Msg: TWMNCHitTest);
- begin
- inherited;
- if FPreventSizing then
- with Msg do
- if Result in [HTLEFT, HTRIGHT, HTBOTTOM, HTBOTTOMRIGHT,
- HTBOTTOMLEFT, HTTOP, HTTOPRIGHT, HTTOPLEFT] then
- Result := longint(HTNOWHERE);
- end;
-
- end.
-